x86: Fix up irq vector map logic
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Mon, 22 Aug 2011 15:15:33 +0000 (16:15 +0100)
committerGeorge Dunlap <george.dunlap@eu.citrix.com>
Mon, 22 Aug 2011 15:15:33 +0000 (16:15 +0100)
commit45627433b2c0eec655bef8d02a48f75bc9b80fc2
treebaca59da6a10167cffa3b95dce47633954ea3aba
parent1ded71e27c5ca61935734eadcd79e722cdf99732
x86: Fix up irq vector map logic

We need to make sure that cfg->used_vector is only cleared once;
otherwise there may be a race condition that allows the same vector to
be assigned twice, defeating the whole purpose of the map.

This makes two changes:
* __clear_irq_vector() only clears the vector if the irq is not being
moved
* smp_iqr_move_cleanup_interrupt() only clears used_vector if this
is the last place it's being used (move_cleanup_count==0 after
decrement).

Also make use of asserts more consistent, to catch this kind of logic
bug in the future.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/arch/x86/io_apic.c
xen/arch/x86/irq.c